﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

using BLL;
using Model;
using System.Data;
using Model.SystemManage;

namespace WebService
{
    /// <summary>
    /// WebService1 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消注释以下行。 
    // [System.Web.Script.Services.ScriptService]
    public class WebService1 : System.Web.Services.WebService
    {
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="Account">账号</param>
        /// <param name="Password">密码</param>
        /// <returns></returns>
        [WebMethod]
        public Model.SystemManage.EmployeeLoginInfo_Model IsLogin(string Account, string Password)
        {
            return new BLL.SystemBLL.EmployeeInfo_Bll().IsLogin(Account, Password);
        }

        /// <summary>
        /// 判断登录后的用户是否有完整的基础信息
        /// </summary>
        /// <param name="EmployID">员工ID</param>
        /// <returns></returns>
        [WebMethod]
        public Model.SystemManage.EmployeeBasicInfo_Model GetIsBasicInfo(int EmployID)
        {
            return new BLL.SystemBLL.EmployeeInfo_Bll().GetIsBasicInfo(EmployID);
        }

        /// <summary>
        /// 获取政治面貌列表信息
        /// </summary>
        /// <returns></returns>
        [WebMethod]
        public string GetPoliticalList()
        {
            return new BLL.SystemBLL.EmployeeInfo_Bll().GetPoliticalList();
        }

        /// <summary>
        /// 获取学历列表信息
        /// </summary>
        /// <returns></returns>
        [WebMethod]
        public string GetEducationList()
        {
            return new BLL.SystemBLL.EmployeeInfo_Bll().GetEducationList();
        }

        /// <summary>
        /// 获取学位信息
        /// </summary>
        /// <returns></returns>
        [WebMethod]
        public string GetPositionList()
        {
            return new BLL.SystemBLL.EmployeeInfo_Bll().GetPositionList();
        }

        /// <summary>
        /// 添加员工基本信息
        /// </summary>
        /// <param name="basic"></param>
        /// <returns></returns>
        [WebMethod]
        public int InsertBasicEmployeeInfo(EmployeeBasicInfo_Model basic)
        {
            return new BLL.SystemBLL.EmployeeInfo_Bll().InsertBasicEmployeeInfo(basic);
        }

        /// <summary>
        /// 删除个人基础信息
        /// </summary>
        /// <param name="EmployeeId">员工ID</param>
        /// <returns></returns>
        [WebMethod]
        public int DeleteBasicEmployeeInfoById(int EmployeeId)
        {
            return new BLL.SystemBLL.EmployeeInfo_Bll().DeleteBasicEmployeeInfoById(EmployeeId);
        }

        /// <summary>
        /// 通过员工ID获取员工基础信息
        /// </summary>
        /// <param name="EmployeeID"></param>
        /// <returns></returns>
        [WebMethod]
        public EmployeeBasicInfo_Model GetBasicEmployeeInfoById(int EmployeeID)
        {
            return new BLL.SystemBLL.EmployeeInfo_Bll().GetBasicEmployeeInfoById(EmployeeID);
        }

        /// <summary>
        /// 获取权限信息
        /// </summary>
        /// <returns></returns>
        [WebMethod]
        public List<LimitInfo_Model> GetLimitInfo(int DeptID, int PositionID)
        {
            return new BLL.SystemBLL.EmployeeInfo_Bll().GetLimitInfo(DeptID, PositionID);
        }

        /// <summary>
        /// 显示部门/角色信息，支持模糊查询
        /// </summary>
        /// <param name="DeptName">角色名称</param>
        /// <returns></returns>
        [WebMethod]
        public List<Dept_Model> GetRoleList(string DeptName)
        {
            return new BLL.SystemBLL.EmployeeInfo_Bll().GetRoleList(DeptName);
        }

        /// <summary>
        /// 添加部门/角色信息
        /// </summary>
        /// <param name="dept">部门实体类传输</param>
        /// <returns></returns>
        [WebMethod]
        public int InsertDeptInfo(Dept_Model dept)
        {
            return new BLL.SystemBLL.EmployeeInfo_Bll().InsertDeptInfo(dept);
        }

        /// <summary>
        /// 员工信息显示
        /// </summary>
        /// <returns></returns>
        [WebMethod]
        public List<EmployeeBasicInfo_Model> GetEmployeeBasicInfo1()
        {
            return new BLL.SystemBLL.EmployeeInfo_Bll().GetEmployeeBasicInfo();
        }

        /// <summary>
        /// 分页/显示员工信息表
        /// </summary>
        /// <param name="PageIndex">当前索引</param>
        /// <param name="PageSize">每页多少条</param>
        /// <param name="count">记录总数量</param>
        /// <returns></returns>
        [WebMethod]
        public List<EmployeeBasicInfo_Model> GetEmployeeBasicInfo2(int PageIndex, int PageSize, out int count, int EmployeeID = 0)
        {
            return new BLL.SystemBLL.EmployeeInfo_Bll().GetEmployeeBasicInfo(PageIndex, PageSize, out count,EmployeeID);
        }

        /// <summary>
        /// 分页/显示员工信息表
        /// </summary>
        /// <param name="PageIndex">当前索引</param>
        /// <param name="PageSize">每页多少条</param>
        /// <param name="count">记录总数量</param>
        /// <param name="EmployeeID">员工姓名</param>
        /// <returns></returns>
        [WebMethod]
        public List<EmployeeBasicInfo_Model> GetEmployeeBasicInfo3(int PageIndex, int PageSize, out int count, string EmployName)
        {
            return new BLL.SystemBLL.EmployeeInfo_Bll().GetEmployeeBasicInfo(PageIndex, PageSize, out count, EmployName);
        }

        /// <summary>
        /// 执行用户角色分配
        /// </summary>
        /// <param name="EmpId"></param>
        /// <param name="DeptID"></param>
        /// <param name="PositionID"></param>
        /// <returns></returns>
        [WebMethod]
        public int SaveEmpDeptAllot(int EmpId, int DeptID, int PositionID)
        {
            return new BLL.SystemBLL.EmployeeInfo_Bll().SaveEmpDeptAllot(EmpId, DeptID, PositionID);
        }

        [WebMethod]
        /// <summary>
        /// 为部门/职位分配权限
        /// </summary>
        /// <param name="DeptId">部门id</param>
        /// <param name="PositionId">职位id</param>
        /// <param name="limitIds">权限id</param>
        /// <returns></returns>
        public int GiveDeptAllotLimit(int DeptId, int PositionId, string limitIds)
        {
            return new BLL.SystemBLL.EmployeeInfo_Bll().GiveDeptAllotLimit(DeptId, PositionId, limitIds);
        }

        [WebMethod]
        /// <summary>
        /// 系统管理员注册员工
        /// </summary>
        /// <param name="register"></param>
        /// <returns></returns>
        public int RegisterEmployee(EmployeeLoginInfo_Model register)
        {
            return new BLL.SystemBLL.EmployeeInfo_Bll().RegisterEmployee(register);
        }

        [WebMethod]
        /// <summary>
        /// 修改员工基础信息审核状态
        /// </summary>
        /// <param name="InfoState">信息状态</param>
        /// <param name="EmpId">员工Id</param>
        /// <returns></returns>
        public int UpdateBasicInfoState(int InfoState, int EmpId)
        {
            return new BLL.SystemBLL.EmployeeInfo_Bll().UpdateBasicInfoState(InfoState, EmpId);
        }

        [WebMethod]
        /// <summary>
        /// 修改员工当前账号状态
        /// </summary>
        /// <param name="InfoState">员工状态</param>
        /// <param name="EmpId">员工Id</param>
        /// <returns></returns>
        public int UpdateLoginInfoState(int PersonState, int EmpId)
        {
            return new BLL.SystemBLL.EmployeeInfo_Bll().UpdateLoginInfoState(PersonState, EmpId);
        }

        [WebMethod]
        /// <summary>
        /// 修改用户密码
        /// </summary>
        /// <param name="EmpId">员工Id</param>
        /// <param name="newpass">新密码</param>
        /// <returns></returns>
        public string EditPassword(int EmpId, string newpass)
        {
            return new BLL.SystemBLL.EmployeeInfo_Bll().EditPassword(EmpId, newpass);
        }
    }
}
